<h2>Station C</h2>

<% category_id = nil %>

<ul>
<% @posts.each do |post| %>
<% if post.category_id != category_id -%>
    <% title = post.category.title %>
    <h2><%= title %></h2>
    
    <% category_id = post.category_id -%>
<% end -%>

    <li><%= link_to(post.title, post_path(post)) %>
        <ul>
    <% post.upcoming_reservations.each do |reservation| %>    
       <li><%= view_reservation(reservation)%></li>
    <% end %>
        </ul>
    </li>
<% end %>
</ul>